package com.ebs.md.api;

/**
 * Revision Author:
 *  $File: //depot/MarketData/commons-md-api/MAIN/src/main/java/com/ebs/md/api/OrderBookListener.java $
 *  $Revision: #4 $
 *  $DateTime: 2012/07/12 16:28:40 $
 *  $Change: 112356 $
 *  $Author: Arik.Sher $
 */

import java.util.Calendar;

import com.ebs.md.api.orderbook.BookEntryPosition;
import com.ebs.md.api.orderbook.BookEntryPositionOfDeleted;


public interface OrderBookListener<OB extends IOrderBook<BE>, BE extends IBookEntry, O extends IOrder>
{
	/**
	 * 
	 * @param OrderBook    - reference to the OrderBook itself
	 * @param newBookEntry - the BookEntry before it is entered into the Book.
	 * @param order        - the Order which affects it.
	 */
	void beforeNewBookEntry(OB orderbook, BE newBookEntry, O order);
	void  afterNewBookEntry(OB orderbook, BE newBookEntry, O order, BookEntryPosition position);
	
	/**
	 * 
	 * @param OrderBook    - reference to the OrderBook itself
	 * @param bookEntry - BookEntry before removed...
	 * @param order     - the Order which affects it.
	 */
	void beforeRemoveBookEntry(OB orderbook, BE bookEntry, O order);
	void  afterRemoveBookEntry(OB orderbook, BE bookEntry, O order, BookEntryPositionOfDeleted position);

	/**
	 * 
	 * @param OrderBook    - reference to the OrderBook itself
	 * @param bookEntry - BookEntry.
	 * @param order     - the Order which affects it.
	 */
	void beforeModifyBookEntry(OB orderbook, BE bookEntry, O order);
	void  afterModifyBookEntry(OB orderbook, BE bookEntry, O order);
	
	/**
	 * 
	 * @param OrderBook - reference to the OrderBook itself
	 * @param isFirst   - is it the first snapshot for that orderbook
	 */
	void beforeSnapshot(OB orderbook, Calendar snapshotTime, boolean isFirst);
	void  afterSnapshot(OB orderbook, Calendar snapshotTime, boolean isFirst);
	
}
